package com.Ajava1704.for并发包下的类.ForCountDownLatch;

import java.util.concurrent.CountDownLatch;

/**
 * @类名: com.Ajava1704.for并发包下的类.ForCountDownLatch
 * @作者: lgt
 * @创建时间: 2020-02-11 20:41
 * @描述:
 **/
public class ForCountRunable implements Runnable {

    private CountDownLatch countDownLatch;

    public ForCountRunable(CountDownLatch countDownLatch,int time) {
        this.countDownLatch = countDownLatch;
        this.time = time;
    }

    private int time;
    @Override
    public void run() {
        try {
            Thread.sleep(time*1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName()+"同学到达门口====");
        countDownLatch.countDown();
    }
}
